﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace CarlowPitBoy
{
    static class Sort
    {
        public static string[] removeNulls(string[] arrayToSort)
        {
            int count = 0;
            int arrayToSortLength = arrayToSort.Length;
            int[] occupiedSpaces = new int[arrayToSortLength];
            string[] returnArray;

            for (int itemsChecked = 0; itemsChecked < arrayToSortLength; itemsChecked++)
            {
                if (arrayToSort[itemsChecked] != null)
                {
                    occupiedSpaces[count] = itemsChecked;
                    count++;
                }
            }

            returnArray = new string[count];

            for (int itemsAssigned = 0; itemsAssigned < count; itemsAssigned++)
                returnArray[itemsAssigned] = arrayToSort[occupiedSpaces[count]];
            
            return returnArray;
        }
    }
}
